package com.pay.web.cust;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by Administrator on 2017-7-4.
 */
public class CustCreateServlet extends HttpServlet {

    /**
     * 进入创建客户页面
     * @param req
     * @param resp
     * @throws ServletException
     * @throws IOException
     */
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.getRequestDispatcher("/WEB-INF/view/cust/cust_create.jsp").forward(req,resp);
    }

    /**
     * 提交创建客户请求
     * @param req
     * @param resp
     * @throws ServletException
     * @throws IOException
     */
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        String custNo = req.getParameter("custNo");
        String custName = req.getParameter("custName");
        String phoneNo = req.getParameter("phoneNo");
        String email = req.getParameter("email");
        String remark = req.getParameter("remark");

        String message = "参数:custNo="+custNo+",custName="+custName+",phoneNo="+phoneNo+",email="+email+",remark="+remark;
        System.out.println(message);

        req.setAttribute("message",message);
        req.getRequestDispatcher("/WEB-INF/view/message.jsp").forward(req,resp);
    }
}
